-
Notifications
You must be signed in to change notification settings - Fork 44
4118 better indexing for rewrite rules #4120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… not fail rewrite)
…-sort-difference-with-functions
…g-for-rewrite-rules
`TopFun` index components are set to `Anything` before computing rule indexes to try. The effect is that all rules (for this index component) will be tried, leading to `Aborts` rather than getting `Stuck` (as the test with the unevaluated function shows).
KEVM tests with insignificant slowdown
Likewise for kontrol tests:
|
|
||
syntax KItem ::= "Done" [symbol(Done)] | ||
|
||
syntax Abcd ::= "A" | "B" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a new sort
syntax Ab ::= "A" [token]
| "B" [token]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, but it actually breaks the demonstration of the unsound behaviour (because the tokens get index Anything
and the Vrule
gets tried first). So I just corrected the indexes in the comments and left the test as-is.
I love the lattice formulation, that reflects unification properties very nicely! As long as we respect the properties of unification, we can be sure our rule indexing will be sound! |
Indexing is extended to
Cell indexes form a (flat) lattice which is now explicit in a less-or-equal definition.
Rule selection now uses a function that selects all rule indexes which are (as a product lattice) greater than the inverted term index (i.e., top element becomes bottom element), with all function indexes turned into
Anything
(top element) before the inversion. The new integration test shows why this is important for soundness.This addresses cases of unevaluated functions in indexed cells where previously booster would (likely) report
Stuck
or (unlikely) a wrong result, while the result should beAborted
(rules were excluded but they could apply depending on what kind of term the unevaluated function would return when evaluated).Fixes #4118